package top.software.util;

/**
 * @ClassName: MessageUtil
 * @Author: Amosen
 * @Since: 2021/4/17
 */
public class MessageUtil {

	public static final Integer BASE_SUCCESS_CODE = 200;

	public static final Integer BASE_FAIL_CODE = 500;

	public static final Integer SERVER_ERROR_CODE = 501;

	public static final Integer ACCOUNT_EXISTS_CODE = 502;

	public static final Integer NOT_EXISTS_CODE = 503;

	public static final Integer LOW_AUTH_CODE = 504;

	public static final Integer UPLOAD_FAIL_CODE = 505;

	public static final Integer EXISTS_FILE_CODE = 506;

	public static final String BASE_SUCCESS_MSG = "request:ok";

	public static final String BASE_FAIL_MSG = "request:fail";

	public static final String SERVER_ERROR_MSG = "Server Error!";

	public static final String ACCOUNT_EXISTS_MSG = "The account has existed";

	public static final String NOT_EXISTS_MSG = "The source you requested does not exist";

	public static final String LOW_AUTH_MSG = "You don't have enough access";

	public static final String UPLOAD_FAIL_MSG = "Upload file error!";

	public static final String EXISTS_FILE_MSG = "The file you have uploaded before!";

	public static Message getMessage() {
		return new Message();
	}

	public static Message getMessage(Integer code, String message) {
		return new Message(code, message);
	}

	public static Message success() {
		return getMessage(BASE_SUCCESS_CODE, BASE_SUCCESS_MSG);
	}

	public static Message fail() {
		return getMessage(BASE_FAIL_CODE, BASE_FAIL_MSG);
	}

	public static Message serverError() {
		return getMessage(SERVER_ERROR_CODE, SERVER_ERROR_MSG);
	}

	public static Message accountExists() {
		return getMessage(ACCOUNT_EXISTS_CODE, ACCOUNT_EXISTS_MSG);
	}

	public static Message notExists() {
		return getMessage(NOT_EXISTS_CODE, NOT_EXISTS_MSG);
	}

	public static Message lowAuth() {
		return getMessage(LOW_AUTH_CODE, LOW_AUTH_MSG);
	}

	public static Message uploadFail() {
		return getMessage(UPLOAD_FAIL_CODE, UPLOAD_FAIL_MSG);
	}

	public static Message existsFile() {
		return getMessage(EXISTS_FILE_CODE, EXISTS_FILE_MSG);
	}

}
